package com.ls.controller.version;

import com.ls.controller.team.model.QueryTeamModel;
import com.ls.controller.version.model.AddVersionModel;
import com.ls.controller.version.model.EditVersionModel;
import com.ls.controller.version.model.QueryVersionModel;
import com.ls.controller.version.model.UpdateStatusModel;
import com.ls.service.IVersionService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 版本更新表 前端控制器
 * </p>
 *
 * @author pengyu
 * @since 2020-05-21
 */
@Api(value = "版本更新相关接口", tags = "版本更新相关接口")
@RestController
@RequestMapping("/version")
@RequiredArgsConstructor
public class VersionController {
    private final IVersionService service;
    /** 版本更新列表 */
    @GetMapping("pageList")
    public ResultData pageList(QueryVersionModel model) {
        return service.pageList(model);
    }
    /**新增版本*/
    @PostMapping("add")
    public ResultData add(@Valid @RequestBody AddVersionModel model) {
        return service.add(model);
    }
    /**编辑版本*/
    @PostMapping("edit")
    public ResultData edit(@Valid @RequestBody EditVersionModel model) {
        return service.edit(model);
    }
    /**删除版本*/
    @PostMapping("del")
    public ResultData del(@RequestParam @NotNull(message = "id不得为空") Integer versionId) {
        return service.del(versionId);
    }
    /**修改版本状态*/
    @PostMapping("updateStatus")
    public ResultData updateStatus(@Valid @RequestBody UpdateStatusModel model) {
        return service.updateStatus(model);
    }
}
